// 表示引入了utils下的request.js文件
import request from '@/utils/request'

export default {
  // 1.讲师列表(条件查询分页)
  getTeacherListPage (current, limit, teacherQuery) {
    return request({
      // url: '/table/list/'+current+"/"+limit,
      url: `/eduservice/teacher/pageTeacherCondition/${current}/${limit}`,
      method: 'post',
      // teacherQuery条件对象，后端使用的是@RequestBody来获取的数据
      // data表示把对象转换成json格式传送到前端当中去
      data: teacherQuery
    })
  },
  // 根据老师的id进行删除
  deleteTeacherId(id) {
    return request({
      url: `/eduservice/teacher/${id}`,
      method: 'delete'
    })
  },
  // 保存老师
  save(teacher) {
    return request({
      url: `/eduservice/teacher/addTeacher`,
      method: 'post',
      // data:teacher表示将对象转换成json传到接口里面去
      data: teacher
    })
  },
  // 点击编辑按钮，进行数据回显
  getTeacherInfo(id) {
    return request({
      url: `/eduservice/teacher/getTeacher/${id}`,
      method: 'get'
    })
  },
  // 更新老师
  updateTeacherInfo(teacher) {
    return request({
      url: `/eduservice/teacher/updateTeacher`,
      method: 'post',
      data: teacher //data:teacher表示将对象转换成json传到接口里面去
    })
  }

}
